package com.dense.kuiniu.floatcabinet.mvp.model;

import com.dense.kuiniu.floatcabinet.mvp.contract.HomeContract;
import com.dense.kuiniu.floatcabinet.mvp.http.api.service.CommonService;
import com.dense.kuiniu.floatcabinet.mvp.http.entity.AdminBean;
import com.dense.kuiniu.floatcabinet.mvp.http.entity.BaseResponse;
import com.dense.kuiniu.floatcabinet.mvp.http.entity.Reader;
import com.dense.kuiniu.floatcabinet.mvp.http.post.AuthenticationBody;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import io.reactivex.Observable;

/**
 * @author Administrator
 * @date 2020/9/28
 */
public class AuthenticationModel extends BaseModel implements HomeContract.Model {
    public AuthenticationModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }


    @Override
    public Observable<BaseResponse<AdminBean>> adminLogin(String account, String password) {
        return mRepositoryManager.obtainRetrofitService(CommonService.class)
                .adminLogin(account, password);
    }

    @Override
    public Observable<BaseResponse<Reader>> readerAuthentication(String account, String password) {
        return mRepositoryManager.obtainRetrofitService(CommonService.class)
                .readerAuthentication(new AuthenticationBody(account));
    }
}